﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="dialog_select_category.aspx.cs" Inherits="Donal.Xms.Web.dongli.dialog.dialog_select_category" %>

<%@ Import Namespace="Donal.Xms.Common" %>

<!DOCTYPE html>
<html>
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,initial-scale=1.0,user-scalable=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <title>选择窗口</title>
    <link rel="stylesheet" type="text/css" href="../../scripts/artdialog/ui-dialog.css" />
    <link rel="stylesheet" type="text/css" href="../skin/icon/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="../skin/default/style.css" />
    <script type="text/javascript" src="../../scripts/jquery/jquery-1.11.2.min.js"></script>
    <script type="text/javascript" src="../../scripts/artdialog/dialog-plus-min.js"></script>
    <script type="text/javascript" charset="utf-8" src="../js/laymain.js"></script>
    <script type="text/javascript" charset="utf-8" src="../js/common.js"></script>

    <script type="text/javascript">
        var api = top.dialog.get(window); //获取父窗体对象

        $(function () {

            //设置按钮及事件
            api.button([
                {
                    value: '确定',
                    callback: function () {
                        appendHtml();
                    },
                    autofocus: true
                }, {
                    value: '取消',
                    callback: function () { }
                }
            ]);

            //初始化已选择的类别
            $(api.data).find("input[name='hidItemId']").each(function () {
                var itemId = $(this).val();
                $(".checkall").each(function () {
                    if ($(this).attr("id") == itemId) {
                        $(this).prop('checked', true);
                    }
                });
            });

            //插入规格节点
            function appendHtml() {
                $(api.data).empty();
                $(".checkall").each(function () {
                    if ($(this).is(':checked')) {
                        execHtml($(this).val(), $(this).attr("id"));
                    }
                });
            }

            //创建品类的HTML
            function execHtml(title, id) {
                let drHtml = "<tr><td align = \"center\" ><input type=\"hidden\" name=\"hidItemId\" value=\"" + id + "\" />" + title + "</td><td align=\"center\"><a style=\"color: blue; cursor: pointer;\" onclick=\"delTr(this);\">删除</a></td></tr>";

                $(api.data).append(drHtml);
            }
        });

    </script>
    <style type="text/css">
        .tree-list .col-1 {
            width: 6%;
            text-align: center;
        }

        .tree-list .col-2 {
            width: 6%;
        }

        .tree-list .col-3 {
            width: 52%;
        }

        .tree-list .col-4 {
            width: 12%;
        }

        .tree-list .col-5 {
            width: 12%;
        }

        .tree-list .col-6 {
            width: 12%;
            text-align: center;
        }
    </style>
    <script type="text/javascript">
        $(function () {
            initCategoryHtml('.tree-list', 1); //初始化分类的结构
            $('.tree-list').initCategoryTree(true); //初始化分类的事件
        });
    </script>
</head>


<body class="mainbody">
    <form id="form1" runat="server">
        <div class="table-container">
            <div class="tree-list">
                <div class="thead">
                    <div class="col col-1">选择</div>
                    <div class="col col-2">编号</div>
                    <div class="col col-3">类别名称</div>
                    <div class="col col-4">调用别名</div>
                </div>
                <ul>
                    <asp:Repeater ID="rptList" runat="server">
                        <ItemTemplate>
                            <li class="layer-<%#Eval("class_layer")%>">
                                <div class="tbody">
                                    <div class="col col-1">
                                        <input type="checkbox" class="checkall" id="<%#Eval("id")%>" value="<%#Eval("title")%>" />
                                    </div>
                                    <div class="col col-2">
                                        <%#Eval("id")%>
                                    </div>
                                    <div class="col index col-3">
                                        <%#Eval("title")%>
                                    </div>
                                    <div class="col col-4">
                                        <%#Eval("call_index")%>
                                    </div>
                                </div>
                            </li>
                        </ItemTemplate>
                    </asp:Repeater>
                </ul>
            </div>
        </div>

    </form>
</body>
</html>
